package com.eastfair.venuebooking.vo;

import com.eastfair.annotation.annotation.dictionary.DictionaryField;
import com.eastfair.annotation.annotation.vo.VoInfo;
import com.eastfair.venuebooking.demand.BusinessOpportunityGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * 商机 VO.
 *
 * @author dqq
 * @date 2022 /6/15
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString(callSuper = true)
@Accessors(chain = true)
public class BusinessOpportunityVO implements Serializable {

    private Map<String, Object> echoMap = new HashMap<>();

    /**
     * id
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private Long id;
    /**
     * 归属人员部门id
     */
    @ApiModelProperty(value = "归属人员部门id")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private Long orgCode;
    /**
     * 归属人员部门名称
     */
    @ApiModelProperty(value = "归属人员部门名称")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String orgName;
    /**
     * 前归属部门
     */
    @ApiModelProperty(value = "前归属部门")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Long lastOrgCode;

    /**
     * 前归属部门名称
     */
    @ApiModelProperty(value = "前归属部门名称")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String lastOrgName;
    /**
     * 归属人员
     */
    @ApiModelProperty(value = "归属人员")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private Long belongTo;

    /**
     * 归属人姓名
     */
    @ApiModelProperty(value = "归属人姓名")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String belongToName;

    /**
     * 前归属人
     */
    @ApiModelProperty(value = "前归属人")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Long lastBelongTo;

    /**
     * 前归属人姓名
     */
    @ApiModelProperty(value = "前归属人姓名")
    @Size(max = 255, message = "前归属人姓名长度不能超过255")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String lastBelongToName;

    /**
     * 商机标题
     */
    @ApiModelProperty(value = "商机标题")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String businessTitle;

    /**
     * 客户id
     */
    @ApiModelProperty(value = "客户id")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private Long customerId;

    /**
     * 客户名称
     */
    @ApiModelProperty(value = "客户名称")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String customerName;

    /**
     * 联系人id
     */
    @ApiModelProperty(value = "联系人id")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private Long contactId;

    /**
     * 联系人姓名
     */
    @ApiModelProperty(value = "联系人姓名")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String contactName;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String remark;

    /**
     * 商机性质，同名数据字典
     */
    @ApiModelProperty(value = "商机性质，同名数据字典")
    @DictionaryField(type = "BUSINESS_PROPERTY")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String businessProperty;

    /**
     * 商机类型，同名数据字典
     */
    @ApiModelProperty(value = "商机类型，同名数据字典")
    @DictionaryField(type = "BUSINESS_TYPES")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String businessType;

    /**
     * 线索id
     */
    @ApiModelProperty(value = "线索id")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private Long saleClueId;

    /**
     * 线索来源（如绑定线索则该线索来源否则用户自己填）
     */
    @ApiModelProperty(value = "线索来源（如绑定线索则该线索来源否则用户自己填）")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String saleClueSource;

    /**
     * 预计销售金额
     */
    @ApiModelProperty(value = "预计销售金额")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private BigDecimal estimateSalesAmount;

    /**
     * 销售阶段（数据字典）
     */
    @ApiModelProperty(value = "销售阶段（数据字典）")
    @DictionaryField(type = "SALES_STAGE")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String salesStage;

    /**
     * 预计签单日期
     */
    @ApiModelProperty(value = "预计签单日期")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private LocalDateTime estimateSignBill;

    /**
     * 商机阶段
     */
    @ApiModelProperty(value = "商机阶段")
    @DictionaryField(type = "BUSINESS_STAGE")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String businessStage;

    /**
     * 客户举办类型 (SPONSOR:主办;UNDERTAKE:承办)
     */
    @ApiModelProperty(value = "客户举办类型 (SPONSOR:主办;UNDERTAKE:承办)")
    @Size(max = 64, message = "客户举办类型 (SPONSOR:主办;UNDERTAKE:承办)长度不能超过64")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String customerIdentity;

    /**
     * 成交机率
     */
    @ApiModelProperty(value = "成交机率")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String dealProbability;

    /**
     * 最后跟进时间
     */
    @ApiModelProperty(value = "最后跟进时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private LocalDateTime lastFollowDate;

    /**
     * 下次跟进时间
     */
    @ApiModelProperty(value = "下次跟进时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private LocalDateTime nextFollowDate;

    /**
     * 展会id
     */
    @ApiModelProperty(value = "展会id")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private Long exhibitionId;

    /**
     * 展会名称
     */
    @ApiModelProperty(value = "展会名称")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private String exhibitionName;

    /**
     * 展览开始时间
     */
    @ApiModelProperty(value = "展览开始时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private LocalDateTime exhibitionStartTime;

    /**
     * 展览结束时间
     */
    @ApiModelProperty(value = "展览结束时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private LocalDateTime exhibitionEndTime;

    /**
     * 布展开始时间
     */
    @ApiModelProperty(value = "布展开始时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private LocalDateTime arrangementStartTime;

    /**
     * 布展结束时间
     */
    @ApiModelProperty(value = "布展结束时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private LocalDateTime arrangementEndTime;

    /**
     * 撤展开始时间
     */
    @ApiModelProperty(value = "撤展开始时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private LocalDateTime dismantlingStartTime;

    /**
     * 撤展结束时间
     */
    @ApiModelProperty(value = "撤展结束时间")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private LocalDateTime dismantlingEndTime;

    /**
     * 展会状态 #{STATE_ONE:无状态;STATE_TWO:销售商机;STATE_THREE:报价确认;STATE_FOUR:活动确认;STATE_FIVE:创立合同;STATE_SIX:合同付款;STATE_SEVEN:活动结算;STATE_EIGHT:活动结束;STATE_NINE:其他状态}
     */
    @ApiModelProperty(value = "展会状态 #{STATE_ONE:无状态;STATE_TWO:销售商机;STATE_THREE:报价确认;STATE_FOUR:活动确认;STATE_FIVE:创立合同;STATE_SIX:合同付款;STATE_SEVEN:活动结算;STATE_EIGHT:活动结束;STATE_NINE:其他状态}")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String exhibitionState;

    /**
     * 未跟进天数
     */
    @ApiModelProperty(value = "未跟进天数")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private Integer notFollowDays;

    /**
     * 报价书数量
     */
    @ApiModelProperty(value = "报价书数量")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {BusinessOpportunityGroup.QueryBusinessOpportunity.class})
    private Integer quotationCount;

    @ApiModelProperty(value = "创建人")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Long createdBy;

    @ApiModelProperty(value = "创建人姓名")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String createdByName;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新人")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Long updatedBy;

    @ApiModelProperty(value = "更新人姓名")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String updatedByName;

    @ApiModelProperty(value = "更新时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    protected LocalDateTime updateTime;
    @ApiModelProperty(value = "销售阶段名称")
    private String salesStageName;
}
